package com.zx.club.common.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 
 * @author zx
 * @date 2025-03-20 14:07
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseResp<T> {
    private Integer code;
    private String msg;
    private T data;
    private Boolean success = false;


    public static <T> BaseResp<T> fail(Integer code ,String msg) {
        return new BaseResp<T>(code,msg,null,false);
    }

    public static <T> BaseResp<T> fail() {
        return new BaseResp<T>(500,"失败",null,false);
    }

    public static <T> BaseResp<T> success() {
        return new BaseResp<T>(200,"成功",null,true);
    }

    public static <T> BaseResp<T> success(T data) {
        return new BaseResp<T>(200,"成功",data,true);
    }
}
